unit editframeform;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  nkTitleBar, TplEditUnit, BCLabel, BCButton;

type

  { TfrmEditFrame }

  TfrmEditFrame = class(TForm)
    BCButton2: TBCButton;
    BCLabel1: TBCLabel;
    Edit1: TplEdit;
    Edit2: TplEdit;
    Label1: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    nkTitleBar1: TnkTitleBar;
    procedure BCButton2Click(Sender: TObject);
    procedure BCLabel1Click(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
  private
    FIsNew: boolean;
    procedure SetIsNew(AValue: boolean);

  public
    property IsNew:boolean read FIsNew write SetIsNew;
  end;

var
  frmEditFrame: TfrmEditFrame;

implementation

{$R *.frm}

{ TfrmEditFrame }

procedure TfrmEditFrame.BCLabel1Click(Sender: TObject);
begin
  ModalResult:=mrCancel;
end;

procedure TfrmEditFrame.FormCloseQuery(Sender: TObject; var CanClose: boolean);
begin
  if ModalResult=mrOK then
  begin
    if (Trim(Edit1.Text)='') or (Trim(Edit2.Text)='') then
    begin
      MessageDlg('大屏名称和地址不能为空。',mtWarning,[mbOK],0);
      CanClose:=False;
      Exit;
    end;
  end;
end;

procedure TfrmEditFrame.BCButton2Click(Sender: TObject);
begin
  ModalResult:=mrOK;
end;

procedure TfrmEditFrame.SetIsNew(AValue: boolean);
begin
  FIsNew:=AValue;
  if FIsNew then
  begin
    Label1.Caption:='新增自定义大屏';
    Edit1.Text:='';
    Edit2.Text:='';
  end
  else
  begin
    Label1.Caption:='编辑自定义大屏';
  end;
end;

end.

